package com.hongkuncheng.cms.controller.admin;

import org.hibernate.LockMode;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Controller;
import com.hongkuncheng.cms.controller.BaseController;
import com.hongkuncheng.cms.model.Notice;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 系统提示
 *
 * @author Administrator
 */
@Controller
@Transactional
@RequestMapping("notice")
public class AnoticeController extends BaseController {

    // 提示处理
    @RequestMapping("process")
    @ResponseBody
    public void process() throws Exception {
        int noticeId = Integer.parseInt(request.getParameter("noticeid"));
        Notice notice = factorySession.get(Notice.class, noticeId, LockMode.PESSIMISTIC_WRITE);
        factorySession.delete(notice);
        response.sendRedirect(notice.getRedirecturl());
    }

}
